using DataDynamics.ActiveReports;
using Microsoft.VisualBasic.CompilerServices;
using System;
namespace TVSReports
{
	internal class clsReports
	{
		public float MakeSameHeight(object objObject)
		{
			return this.MakeSameHeight(objObject, null);
		}
		public float MakeSameHeight(object objObject, object sngHeight)
		{
			float result = 0f;
			float num = 0f;
			try
			{
				if (objObject != null)
				{
					NewLateBinding.LateSet(objObject, null, "KeepTogether", new object[]
					{
						true
					}, null, null);
					int num3;
					if (sngHeight == null)
					{
						int num2 = Conversions.ToInteger(Operators.SubtractObject(NewLateBinding.LateGet(NewLateBinding.LateGet(objObject, null, "Controls", new object[0], null, null, null), null, "Count", new object[0], null, null, null), 1));
						num3 = 0;
						while (true)
						{
							int num4 = num2;
							if (num3 > num4)
							{
								break;
							}
							object[] array = new object[]
							{
								num3
							};
							bool[] array2 = new bool[]
							{
								true
							};
							if (array2[0])
							{
								num3 = (int)Conversions.ChangeType(array[0], typeof(int));
							}
							if (NewLateBinding.LateGet(objObject, null, "Controls", array, null, null, array2) is TextBox)
							{
								object[] array3 = new object[]
								{
									num3
								};
								bool[] array4 = new bool[]
								{
									true
								};
								if (array4[0])
								{
									num3 = (int)Conversions.ChangeType(array3[0], typeof(int));
								}
								if (Operators.ConditionalCompareObjectGreater(NewLateBinding.LateGet(NewLateBinding.LateGet(objObject, null, "Controls", array3, null, null, array4), null, "Height", new object[0], null, null, null), num, false))
								{
									object[] array5 = new object[]
									{
										num3
									};
									bool[] array6 = new bool[]
									{
										true
									};
									if (array6[0])
									{
										num3 = (int)Conversions.ChangeType(array5[0], typeof(int));
									}
									num = Conversions.ToSingle(NewLateBinding.LateGet(NewLateBinding.LateGet(objObject, null, "Controls", array5, null, null, array6), null, "Height", new object[0], null, null, null));
								}
							}
							num3++;
						}
					}
					else
					{
						num = Conversions.ToSingle(sngHeight);
					}
					int num5 = Conversions.ToInteger(Operators.SubtractObject(NewLateBinding.LateGet(NewLateBinding.LateGet(objObject, null, "Controls", new object[0], null, null, null), null, "Count", new object[0], null, null, null), 1));
					num3 = 0;
					while (true)
					{
						int num4 = num5;
						if (num3 > num4)
						{
							break;
						}
						object[] array7 = new object[]
						{
							num3
						};
						bool[] array6 = new bool[]
						{
							true
						};
						if (array6[0])
						{
							num3 = (int)Conversions.ChangeType(array7[0], typeof(int));
						}
						if (NewLateBinding.LateGet(objObject, null, "Controls", array7, null, null, array6) is TextBox)
						{
							object[] array8 = new object[]
							{
								num3
							};
							bool[] array4 = new bool[]
							{
								true
							};
							if (array4[0])
							{
								num3 = (int)Conversions.ChangeType(array8[0], typeof(int));
							}
							object[] array = new object[]
							{
								num
							};
							NewLateBinding.LateSetComplex(NewLateBinding.LateGet(objObject, null, "Controls", array8, null, null, array4), null, "Height", array, null, null, false, true);
						}
						num3++;
					}
					result = num;
				}
			}
			catch (Exception ex2)
			{
				Exception ex = ex2;
				throw ex;
			}
			return result;
		}
	}
}
